﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="KpiUserMgr.aspx.cs" Inherits="kpi.KpiUserManager.KpiUserMgr" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
    </div>
    <div>
        <asp:GridView ID="GridView_KpiUserMgr" runat="server" AutoGenerateColumns="False"
            DataKeyNames="id" DataSourceID="SqlDataSource_KpiUserMgr">
            <Columns>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />
                <asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
                <asp:BoundField DataField="u_kpi" HeaderText="关键绩效指标（KPI）" SortExpression="u_kpi" />
                <asp:BoundField DataField="u_kpi_std" HeaderText="考核标准" SortExpression="u_kpi_std" />
                <asp:BoundField DataField="u_kpi_comm" HeaderText="KPI说明" SortExpression="u_kpi_comm" />
                <asp:BoundField DataField="u_kpi_rat" HeaderText="权重" SortExpression="u_kpi_rat" />
                <asp:BoundField DataField="u_kpi_fx" HeaderText="计算方式" SortExpression="u_kpi_fx" />
                <asp:BoundField DataField="u_kpi_m" HeaderText="u_kpi_m" SortExpression="u_kpi_m" />
                <asp:BoundField DataField="u_kpi_conf" HeaderText="u_kpi_conf" SortExpression="u_kpi_conf" />
                <asp:BoundField DataField="u_kpi_ref" HeaderText="信息来源" SortExpression="u_kpi_ref" />
                <asp:BoundField DataField="uM_kpi_rec" HeaderText="考评得分" SortExpression="uM_kpi_rec" />
                <asp:BoundField DataField="u_kpi_rec" HeaderText="自评得分" SortExpression="u_kpi_rec" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource_KpiUserMgr" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:kpi_forms_dbConnectionString %>" 
            DeleteCommand="DELETE FROM [u_kpi_table] WHERE [id] = @original_id AND [UserName] = @original_UserName AND [u_kpi] = @original_u_kpi AND [u_kpi_std] = @original_u_kpi_std AND [u_kpi_comm] = @original_u_kpi_comm AND [u_kpi_rat] = @original_u_kpi_rat AND (([u_kpi_fx] = @original_u_kpi_fx) OR ([u_kpi_fx] IS NULL AND @original_u_kpi_fx IS NULL)) AND (([u_kpi_m] = @original_u_kpi_m) OR ([u_kpi_m] IS NULL AND @original_u_kpi_m IS NULL)) AND [u_kpi_conf] = @original_u_kpi_conf AND [u_kpi_ref] = @original_u_kpi_ref AND [uM_kpi_rec] = @original_uM_kpi_rec AND [u_kpi_rec] = @original_u_kpi_rec"
            InsertCommand="INSERT INTO [u_kpi_table] ([id], [UserName], [u_kpi], [u_kpi_std], [u_kpi_comm], [u_kpi_rat], [u_kpi_fx], [u_kpi_m], [u_kpi_conf], [u_kpi_ref], [uM_kpi_rec], [u_kpi_rec]) VALUES (@id, @UserName, @u_kpi, @u_kpi_std, @u_kpi_comm, @u_kpi_rat, @u_kpi_fx, @u_kpi_m, @u_kpi_conf, @u_kpi_ref, @uM_kpi_rec, @u_kpi_rec)"
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT [id], [UserName], [u_kpi], [u_kpi_std], [u_kpi_comm], [u_kpi_rat], [u_kpi_fx], [u_kpi_m], [u_kpi_conf], [u_kpi_ref], [uM_kpi_rec], [u_kpi_rec] FROM [u_kpi_table] ORDER BY [UserName]"
            UpdateCommand="UPDATE [u_kpi_table] SET [UserName] = @UserName, [u_kpi] = @u_kpi, [u_kpi_std] = @u_kpi_std, [u_kpi_comm] = @u_kpi_comm, [u_kpi_rat] = @u_kpi_rat, [u_kpi_fx] = @u_kpi_fx, [u_kpi_m] = @u_kpi_m, [u_kpi_conf] = @u_kpi_conf, [u_kpi_ref] = @u_kpi_ref, [uM_kpi_rec] = @uM_kpi_rec, [u_kpi_rec] = @u_kpi_rec WHERE [id] = @original_id AND [UserName] = @original_UserName AND [u_kpi] = @original_u_kpi AND [u_kpi_std] = @original_u_kpi_std AND [u_kpi_comm] = @original_u_kpi_comm AND [u_kpi_rat] = @original_u_kpi_rat AND (([u_kpi_fx] = @original_u_kpi_fx) OR ([u_kpi_fx] IS NULL AND @original_u_kpi_fx IS NULL)) AND (([u_kpi_m] = @original_u_kpi_m) OR ([u_kpi_m] IS NULL AND @original_u_kpi_m IS NULL)) AND [u_kpi_conf] = @original_u_kpi_conf AND [u_kpi_ref] = @original_u_kpi_ref AND [uM_kpi_rec] = @original_uM_kpi_rec AND [u_kpi_rec] = @original_u_kpi_rec">
            <DeleteParameters>
                <asp:Parameter Name="original_id" Type="Object" />
                <asp:Parameter Name="original_UserName" Type="String" />
                <asp:Parameter Name="original_u_kpi" Type="String" />
                <asp:Parameter Name="original_u_kpi_std" Type="String" />
                <asp:Parameter Name="original_u_kpi_comm" Type="String" />
                <asp:Parameter Name="original_u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_fx" Type="String" />
                <asp:Parameter Name="original_u_kpi_m" Type="String" />
                <asp:Parameter Name="original_u_kpi_conf" Type="String" />
                <asp:Parameter Name="original_u_kpi_ref" Type="String" />
                <asp:Parameter Name="original_uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_rec" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="id" Type="Object" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="u_kpi" Type="String" />
                <asp:Parameter Name="u_kpi_std" Type="String" />
                <asp:Parameter Name="u_kpi_comm" Type="String" />
                <asp:Parameter Name="u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="u_kpi_fx" Type="String" />
                <asp:Parameter Name="u_kpi_m" Type="String" />
                <asp:Parameter Name="u_kpi_conf" Type="String" />
                <asp:Parameter Name="u_kpi_ref" Type="String" />
                <asp:Parameter Name="uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="u_kpi_rec" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="u_kpi" Type="String" />
                <asp:Parameter Name="u_kpi_std" Type="String" />
                <asp:Parameter Name="u_kpi_comm" Type="String" />
                <asp:Parameter Name="u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="u_kpi_fx" Type="String" />
                <asp:Parameter Name="u_kpi_m" Type="String" />
                <asp:Parameter Name="u_kpi_conf" Type="String" />
                <asp:Parameter Name="u_kpi_ref" Type="String" />
                <asp:Parameter Name="uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="u_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_id" Type="Object" />
                <asp:Parameter Name="original_UserName" Type="String" />
                <asp:Parameter Name="original_u_kpi" Type="String" />
                <asp:Parameter Name="original_u_kpi_std" Type="String" />
                <asp:Parameter Name="original_u_kpi_comm" Type="String" />
                <asp:Parameter Name="original_u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_fx" Type="String" />
                <asp:Parameter Name="original_u_kpi_m" Type="String" />
                <asp:Parameter Name="original_u_kpi_conf" Type="String" />
                <asp:Parameter Name="original_u_kpi_ref" Type="String" />
                <asp:Parameter Name="original_uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_rec" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    <br />
    <hr />
    <br />
    <%--<div>
        <asp:GridView ID="GridView_ASP_netUserMgr" runat="server" AutoGenerateColumns="False"
            DataKeyNames="ApplicationId,LoweredUserName" DataSourceID="SqlDataSource_ASP_net_UserMgr">
            <Columns>
                <asp:BoundField DataField="ApplicationId" HeaderText="ApplicationId" ReadOnly="True"
                    SortExpression="ApplicationId" />
                <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" />
                <asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
                <asp:BoundField DataField="LoweredUserName" HeaderText="LoweredUserName" ReadOnly="True"
                    SortExpression="LoweredUserName" />
                <asp:BoundField DataField="MobileAlias" HeaderText="MobileAlias" SortExpression="MobileAlias" />
                <asp:CheckBoxField DataField="IsAnonymous" HeaderText="IsAnonymous" SortExpression="IsAnonymous" />
                <asp:BoundField DataField="LastActivityDate" HeaderText="LastActivityDate" SortExpression="LastActivityDate" />
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource_ASP_net_UserMgr" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
            DeleteCommand="dbo.aspnet_Users_DeleteUser" DeleteCommandType="StoredProcedure"
            SelectCommand="aspnet_Membership_GetAllUsers" SelectCommandType="StoredProcedure">
            <SelectParameters>            
            <asp:Parameter DefaultValue="/" Name="ApplicationName" Type="String" />
            <asp:Parameter DefaultValue="0" Name="PageIndex" Type="Int32" />
            <asp:Parameter DefaultValue="2147483647" Name="PageSize" Type="Int32" />
        </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ApplicationName" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="LoweredUserName" />
            </DeleteParameters>
        </asp:SqlDataSource>
    </div>--%>
    <div>
        <code>declare @p4 int set @p4=3 exec dbo.aspnet_Users_DeleteUser @ApplicationName=N'/',@UserName=N'123',@TablesToDeleteFrom=15,@NumTablesDeletedFrom=@p4
            output select @p4 </code>
        <br />
        <code>exec dbo.aspnet_Membership_GetAllUsers @ApplicationName=N'/',@PageIndex=0,@PageSize=2147483647</code>
        <br />
        <code>exec dbo.aspnet_UsersInRoles_AddUsersToRoles @ApplicationName=N'/',@RoleNames=N'user',@UserNames=N'test1',@CurrentTimeUtc='2013-02-20 02:09:20.4300000'</code>
    </div>
</asp:Content>
